<?php
/**
 * 《银行联行号管理》实现类
 *
 * @author 孙晓晔
 * @version $Id: Country.class.php 1035 2010-03-26 05:24:59Z sunxy $
 */
require_once(dirname(__FILE__) . '/CoreUtil.class.php');

class Yang extends CoreUtil {
	function __construct() {
		$request['update'] = '$Date: 2009/02/16 07:36:07 $';
		$request['revision'] = '$Revision: 1.1 $';
	
		parent::__construct($request);
	}
	
	function tab($controller, $request) {
		$data = array(
			'类库检测' => array('cc'=>'core.php?do=Yang.find', 'js'=>''),
			'数据库表' => array('cc'=>'core.php?do=Table.find', 'js'=>''),
				
			'统计分析' => array('cc'=>'core.php?do=Yang.tj_tab', 'js'=>''),
		);
	
		$ret = $this->_tab($data);
	
		$controller->assign_by_ref('result', $ret);
	
		$controller->display($request, 'tab');
		return true;
	}
	
	function tj_tab($controller, $request) {
		$data = array(
			'供应商' => array('cc'=>'contact.php?do=Supplier.group', 'js'=>''),
		);
	
		$ret = $this->_tab($data);
	
		$controller->assign_by_ref('result', $ret);
	
		$controller->display($request, 'tj_tab');
		return true;
	}
	
	function find($controller, $request) {
		echo error_reporting();
		
// 		include_once "/usr/lib/php/pear/Mail.php";
		
// 		if (class_exists("Mail")) {
// 			echo "OK";
// 		} else {
// 			echo "22222";
// 		}
		
		$a = array();
		$a[] = array("file"=>"HTTP/Upload.php", "clazz"=>"HTTP_Upload");
		$a[] = array("file"=>"Net/SMTP.php", "clazz"=>"Net_SMTP");
		$a[] = array("file"=>"Mail.php", "clazz"=>"Mail");
		$a[] = array("file"=>"Mail/mimeDecode.php", "clazz"=>"Mail_mimeDecode");
		
		// $a[] = array("file"=>"Mail.php Mail/mail.php", "clazz"=>"Mail_mail");
		$a[] = array("file"=>"Image/Barcode.php", "clazz"=>"Image_Barcode");
		$a[] = array("file"=>"Image/Barcode2.php", "clazz"=>"Image_Barcode2");
		
		// print_r($a, true);
		// $a = array("HTTP_Upload", "Mail_mimeDecode", "Mail_mail");
		$data = array();
		while (list($k, $v) = each($a)) {
			// print_r($v);
			$data[] = $this->_clazz($v) or die("2222");
		}
		
		// method_exists('Directory','read')
		
		$controller->assign_by_ref('result', $data);
	
		$controller->display($request, 'core/yang/find');
		return true;
	}
	
	function _clazz($v) {
		$file = $v['file'];
		$clazz = $v['clazz'];
		
		$ret = array();
		
		$ret['name'] = $clazz;
		$ret['status'] = 'None';
		
		$a = preg_split("/(\s|;)/", $file);
		// print_r($a);
		while (list($k, $v) = each($a)) {
		
			if (!include($v)) {
				return $ret;
			}
		}
		
		if (class_exists($clazz)) {
			$ret['status'] = 'OK';
		} else {
			$ret['status'] = 'Error';
		}
		
		return $ret;
	}
}
